import { root } from '@/api/apiRoot';
import type { IResData, IQuery } from '@/api/indexTypes';
import type {
  MemberLeaderListData,
  ILevelDownListRes,
  ITypeDownListRes,
  MemberLeaderListResult,
  AppPotentialClientAddData,
  MemberCardPriceResult,
} from './types';
import { defHttp } from '@/utils/http';

export const Api = {
  levelDownList: root + 'memberLevel/getDownList',
  typeDownList: root + 'memberType/getDownList',

  //会员分组列表
  memberGroupList: root + 'headquarters-group/pageList',
  //会员服务专员列表
  memberServiceList: root + 'headquarters-attache/getUserList',
  // 负责人列表(all)
  memberLeaderList: root + 'member/leaderList',


  memberCardPrice: root + 'member-contacts/cardPrice',
  myMemberContacts: root + 'app-user-unlock-leading/page',
  // 添加意向客户数据
  appPotentialClientAdd: root + 'app-potential-client/add'
};

/**
 * 会员级别下拉数据
 * @export
 * @return {*}  {Promise<ILevelDownListRes[]>}
 */
export function levelDownList(): Promise<ILevelDownListRes[]> {
  return defHttp.get({
    url: Api.levelDownList,
  });
}

/**
 * 组织类别下拉数据
 * @export
 * @return {*}  {Promise<ITypeDownListRes[]>}
 */
export function typeDownList(): Promise<ITypeDownListRes[]> {
  return defHttp.get({
    url: Api.typeDownList,
  });
}

/**
 * 会员分组列表
 * @export
 * @return {*}  {Promise<any>}
 */
export function memberGroupList(): Promise<any> {
  return defHttp.get({
    url: Api.memberGroupList,
  });
}

/**
 * 会员服务专员列表
 * @export
 * @return {*}  {Promise<any>}
 */
export function memberServiceList(): Promise<any> {
  return defHttp.post({
    url: Api.memberServiceList,
    data: {},
  });
}

/**
 * @description 获取负责人列表 (all)
 * @date 28/09/2022
 * @export
 * @param {MemberLeaderListData} data
 */
export function memberLeaderList(data: MemberLeaderListData) {
  return defHttp.post<IResData<MemberLeaderListResult>>({
    url: Api.memberLeaderList,
    data,
  });
}

/**
 * @description 添加意向客户
 * @date 16/11/2022
 * @export
 * @param {AppPotentialClientAddData} data
 */
export function appPotentialClientAdd(data: AppPotentialClientAddData) {
  return defHttp.post({
    url: Api.appPotentialClientAdd,
    data,
  });
}

/**
 * @descriptiond 我的人脉列表
 * @date 06/03/2023
 * @export
 * @param {IQuery} data
 */
export function myMemberContacts(data: IQuery) {
  return defHttp.post({
    url: Api.myMemberContacts,
    data
  })
}


/**
 * @description 获取名片解锁价格(人脉)
 * @date 21/02/2023
 * @export
 * @param {number} queryTenantId 租户ID
 */
export function memberCardPrice(queryTenantId: number) {
  return defHttp.get<MemberCardPriceResult>({
    url: Api.memberCardPrice,
    data: {
      queryTenantId
    }
  })
}